﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace paper.evisa99.com.Controllers.Class
{
    public static class Authority
    {
        public static string Ver = "1.0s";
        public static bool ValidKey(string key, string tsr)
        {
            bool result = false;
            if (key == "yfara212121") { result = true; }
            if (!result)
            {
                if (key == System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(DateTime.Now.ToString("yyyyMMdd") + "liu@2121" + tsr, "md5")) { result = true; }
            }
            return result;
        }
        public static string GenKey(string tsr)
        {
            return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(DateTime.Now.ToString("yyyyMMdd") + "liu@2121" + tsr, "md5");
        }

        public static string GenPassword(string UserName)
        {
            Random ran = new Random();
            string Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(UserName, "md5");
            Password = Password.Substring(ran.Next(0, 24), 6).ToLower();
            return Password;
        }
        public static string MD5(string UserName)
        {
            return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(UserName + "liu212121", "md5");
        }

    }
}